/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.classdiagram.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PolygonDecoration;

import com.cea.papyrus.core.figures.connection.EdgeFigure;


/**
 * 
 */
public class GeneralizationFigure extends EdgeFigure {

	/**
	 * 
	 */
	private Label label;
	
	/**
	 * 
	 */
	public GeneralizationFigure() {
		super();
		PolygonDecoration dec = new PolygonDecoration();
		dec.setScale( 15, 5);
		dec.setBackgroundColor( ColorConstants.white);
		dec.setLineWidth(1);
		setTargetDecoration(dec); // arrow at target endpoint
		setLineStyle(Graphics.LINE_SOLID);  // line drawing style
		setLineWidth(2);
		setForegroundColor( ColorConstants.black);
		
	}
	
	/**
	 * 
	 * 
	 * @param text 
	 */
	@Override
	public void setName(String text){
		label.setText(text);
	}
	
	/**
	 * 
	 * 
	 * @param graphics 
	 */
	@Override
	public void paintFigure(Graphics graphics) {
		graphics.pushState();
		super.paintFigure(graphics);
		if (img!=null){
		super.FillFigure(graphics);}
		graphics.popState();
	}
	
	/*DOC*/
	/*protected void outlineShape(Graphics g) {
		PointList pointList = getPoints();
		Point source = pointList.getFirstPoint();
		Point target = pointList.getLastPoint();
		
                // It isn't the good calcul, it's just to test
		int x = target.x;
		int y = target.y;
		int width = (int) source.getDistance(target);
		g.drawArc(target.x, target.y, width, width, 90, 180);
	}*/
	
	}